//
//  UpdateStreamCommand.m
//  Pennyworth
//
//  Created by Chris Karr on 7/24/08.
//  Copyright 2008 Northwestern University. All rights reserved.
//

#import "UpdateStreamCommand.h"
#import "AppDelegate.h"

@implementation UpdateStreamCommand

- (id) performDefaultImplementation
{
	NSString * name = [[self evaluatedArguments] valueForKey:@"name"];
	NSString * streamName = [[self evaluatedArguments] valueForKey:@"streamName"];
	
	if (name == nil)
	{
		[self setScriptErrorNumber:errAEParamMissed];
		[self setScriptErrorString:[NSString stringWithFormat:@"No update name provided."]];
	}
	else
	{
		NSMutableDictionary * note = [NSMutableDictionary dictionary];
		[note setValue:streamName forKey:KEY];
		[note setValue:name forKey:PREDICTION];
		
		[[NSNotificationCenter defaultCenter] postNotificationName:PREDICTION_FETCHED object:self userInfo:note];
	}
	
	return nil;
}

@end
